# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.OSConfig.V1.Model.PatchDeployment do
  @moduledoc """
  Patch deployments are configurations that individual patch jobs use to complete a patch. These configurations include instance filter, package repository settings, and a schedule. For more information about creating and managing patch deployments, see [Scheduling patch jobs](https://cloud.google.com/compute/docs/os-patch-management/schedule-patch-jobs).

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time the patch deployment was created. Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Optional. Description of the patch deployment. Length of the description is limited to 1024 characters.
  *   `duration` (*type:* `String.t`, *default:* `nil`) - Optional. Duration of the patch. After the duration ends, the patch times out.
  *   `instanceFilter` (*type:* `GoogleApi.OSConfig.V1.Model.PatchInstanceFilter.t`, *default:* `nil`) - Required. VM instances to patch.
  *   `lastExecuteTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The last time a patch job was started by this deployment. Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Unique name for the patch deployment resource in a project. The patch deployment name is in the form: `projects/{project_id}/patchDeployments/{patch_deployment_id}`. This field is ignored when you create a new patch deployment.
  *   `oneTimeSchedule` (*type:* `GoogleApi.OSConfig.V1.Model.OneTimeSchedule.t`, *default:* `nil`) - Required. Schedule a one-time execution.
  *   `patchConfig` (*type:* `GoogleApi.OSConfig.V1.Model.PatchConfig.t`, *default:* `nil`) - Optional. Patch configuration that is applied.
  *   `recurringSchedule` (*type:* `GoogleApi.OSConfig.V1.Model.RecurringSchedule.t`, *default:* `nil`) - Required. Schedule recurring executions.
  *   `rollout` (*type:* `GoogleApi.OSConfig.V1.Model.PatchRollout.t`, *default:* `nil`) - Optional. Rollout strategy of the patch job.
  *   `state` (*type:* `String.t`, *default:* `nil`) - Output only. Current state of the patch deployment.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time the patch deployment was last updated. Timestamp is in [RFC3339](https://www.ietf.org/rfc/rfc3339.txt) text format.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :description => String.t() | nil,
          :duration => String.t() | nil,
          :instanceFilter => GoogleApi.OSConfig.V1.Model.PatchInstanceFilter.t() | nil,
          :lastExecuteTime => DateTime.t() | nil,
          :name => String.t() | nil,
          :oneTimeSchedule => GoogleApi.OSConfig.V1.Model.OneTimeSchedule.t() | nil,
          :patchConfig => GoogleApi.OSConfig.V1.Model.PatchConfig.t() | nil,
          :recurringSchedule => GoogleApi.OSConfig.V1.Model.RecurringSchedule.t() | nil,
          :rollout => GoogleApi.OSConfig.V1.Model.PatchRollout.t() | nil,
          :state => String.t() | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:description)
  field(:duration)
  field(:instanceFilter, as: GoogleApi.OSConfig.V1.Model.PatchInstanceFilter)
  field(:lastExecuteTime, as: DateTime)
  field(:name)
  field(:oneTimeSchedule, as: GoogleApi.OSConfig.V1.Model.OneTimeSchedule)
  field(:patchConfig, as: GoogleApi.OSConfig.V1.Model.PatchConfig)
  field(:recurringSchedule, as: GoogleApi.OSConfig.V1.Model.RecurringSchedule)
  field(:rollout, as: GoogleApi.OSConfig.V1.Model.PatchRollout)
  field(:state)
  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.OSConfig.V1.Model.PatchDeployment do
  def decode(value, options) do
    GoogleApi.OSConfig.V1.Model.PatchDeployment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.OSConfig.V1.Model.PatchDeployment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
